{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}
{block name="content"}

<div class="t-detail-goods">
    <div class="t-detail-goods-tit mag">基本信息：</div>
    <div class="t-detail-goods-con t-buser">
    	<table class="wxtables tables-form">
            <colgroup>
                <col width="10%">
                <col width="90%">
            </colgroup>
            <tbody>
                <tr>
                    <td class="tables-form-title">项目名称：</td>
					<td>{$project.project_name}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">融资金额：</td>
					<td>{$project.financing_money}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">领域：</td>
					<td>{$project.field_name}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">阶段：</td>
					<td>{$project.phase_name}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">发布时间：</td>
					<td>{$project.addtime}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">图片：</td>
                    <td><img src="{$project.pic}" style="width:50px;"></td>
                </tr>
                <tr>
                    <td class="tables-form-title">项目亮点：</td>
                    <td>{$project.project_highlight}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">项目简介：</td>
                    <td>{$project.project_desc}</td>
                </tr>
                {if $project.plan_book}
                <tr>
                    <td class="tables-form-title">商业计划书：</td>
                    <td>
                        <button class="btn btn-blue" id="upload-plan">修改商业计划书</button>
                        <a href="{$project.plan_book}">点击下载>>>商业计划书下载<<<</a>
                    </td>

                </tr>
                {else}
                <tr>
                    <td class="tables-form-title">商业计划书：</td>
                    <td><button class="add icon fl icon_upload_default3x btn btn-blue" id="upload-plan">上传商业计划书</button></td>
                    <input type="hidden" name='plan_book'>
                </tr>
                {/if}



                {if $project.cover}
                <tr>
                    <td class="tables-form-title">自荐材料：</td>
                    <td>
                        <button class="btn btn-blue" id="upload-cover">修改自荐材料</button>
                        <a href="{$project.cover}">点击下载>>>自荐材料下载<<<</a>
                    </td>
                </tr>
                {else}
                <tr>
                    <td class="tables-form-title">自荐材料：</td>
                    <td><button class="add icon fl icon_upload_default3x btn btn-blue" id="upload-cover">上传自荐材料</button></td>
                    <input type="hidden" name='cover'>
                </tr>
                {/if}
            </tbody>
        </table>
    </div>
</div>
{/block}

{block name="js"}
<script>
    var id = {$project.project_id};
</script>
{literal}
<style>
#jpops .fi-name{width:100px;}
#jpops .form-controls{margin-left:100px;}
</style>
<script type="text/javascript" src="/Public/Js/front/front_js/ajaxupload.3.5.js"></script>
<script>
    new AjaxUpload("#upload-plan", {
        action: "/Acp/uploadFileHandler",
        name: "upfile",
        responseType: "json",
        onSubmit: function(){
            //alert('正在上传');
            //preview处的图片改为loading图片
            /*$('.preview-plan').show();
             if($("#upload-plan").siblings('.preview-plan').find('img').length>=3){
             alert("最多上传3张图片");
             return false;
             }*/
        },
        onChange: function(file, extension){
            if (extension && /^(doc|docx|pdf|xls|xlsx)$/.test(extension)) {
                return true;
            }
            else {
                alert('暂不支持该文件格式')
                return false;
            }
        },
        onComplete: function(file, response){
//              console.log(response);
              console.log(file);
            if (response.status === 0) {
                alert(response.msg);
                location.reload();
            }
            else if (response.status === 1) {

                $.ajax({
                    type:'post',
                    url:'/AcpProject/add_plan_book',
                    data:{id:id,url:response.img_url},
                    success:function (data) {
                        if(data.code==1){
                            alert(data.msg);
                        }else{
                            alert(data.msg);
                        }
                    }
                })
            }
        }
    });

    new AjaxUpload("#upload-cover", {
        action: "/Acp/uploadFileHandler",
        name: "upfile",
        responseType: "json",
        onSubmit: function(){
            //alert('正在上传');
            //preview处的图片改为loading图片
            /*$('.preview-plan').show();
             if($("#upload-plan").siblings('.preview-plan').find('img').length>=3){
             alert("最多上传3张图片");
             return false;
             }*/
        },
        onChange: function(file, extension){
            if (extension && /^(doc|docx|pdf|xls|xlsx)$/.test(extension)) {
                return true;
            }
            else {
                alert('暂不支持该文件格式')
                return false;
            }
        },
        onComplete: function(file, response){
//              console.log(response);
            console.log(file);
            if (response.status === 0) {
                alert(response.msg);
                location.reload();
            }
            else if (response.status === 1) {

                $.ajax({
                    type:'post',
                    url:'/AcpProject/add_cover',
                    data:{id:id,url:response.img_url},
                    success:function (data) {
                        if(data.code==1){
                            alert(data.msg);
                        }else{
                            alert(data.msg);
                        }
                    }
                })
            }
        }
    });




</script>


{/literal}
{/block}

{block name="css"}
<link rel="stylesheet" href="/Public/Css/acp/AcpOrder/order_detail.css" type="text/css" />
{/block} 
